package com.bite.blog.mapper;

import com.bite.blog.model.BlogInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface BlogMapper {
    @Select("select * from blog where delete_flag = 0 order by create_time desc")
    List<BlogInfo> selectAllBlog();

    @Select("select * from blog where delete_flag = 0 and id = #{blogId}")
    BlogInfo selectById(Integer blogId);

    Integer updateBlog(BlogInfo blogInfo);

    @Insert("insert into blog (title,content,user_id) values(#{title},#{content},#{userId})")
    Integer insertBlog(BlogInfo blogInfo);
}
